﻿@model dynamic

@{
    ViewBag.Title = "title";
    Layout = null;
}
<script src="~/Scripts/jquery-1.10.2.min.js"></script>

<script src="~/Scripts/vue.js"></script>
<h2>检查插件包元数据</h2>
<div>
    说明：财务接口、电子签章是独立应用，需要单独发包，但是元数据还是放在售楼系统下，所以在publish.yaml中需要单独指定元数据
</div>
<table style="width:100%">
    <tr>
        <td><span>代码仓库地址：</span></td>
        <td> <input id="txtGitPath" style="width: 1000px;" value="https://git.mingyuanyun.com/erpcp/slcp/slxt_cwjk.git" /></td>
    </tr>
    <tr>
        <td><span>分支：</span></td>
        <td><input id="txtGitFeature" style="width: 1000px;" value="feature/5月SP1" /></td>
    </tr>
    <tr>
        <td><span>是否保留代码：</span></td>
        <td><input type="checkbox" id="bldmCk" /></td>
    </tr>
</table>

<button id="btnGetMeate">列出元数据</button>
<button id="btnCheckLan">列出多语言key</button>
<div id="resultDiv">
    <span v-for="m in MeateList">
        {{ m }}<br />
    </span>
</div>

<script>
    var vueData = new Vue({
        el: '#resultDiv',
        data: {
            MeateList: []
        }
    });
    var me = this;
    var txtGitPath;
    var txtGitFeature;
    $(document).ready(function () {

        $("#btnGetMeate").on("click", me.getMeateList);
        $("#btnCheckLan").on("click", me.checkLan);
    });
    /**
     * 获取元数据
     */
    function getMeateList($obj) {
        if (me.Validate() == false) {
            return;
        }
        var $obj = $(this);
        $obj.attr("disabled", "disabled");
        $.ajax({
            url: "@Url.Content("GetMateList")",
            data: "gitPath=" + txtGitPath + "&feature=" + txtGitFeature,
            dataType: "json",
            success: function(re) {
                vueData.MeateList = re;
            },
            error: function(a, b, c) {
                alert(a.responseText);
            },
            complete: function () {
                $obj.removeAttr("disabled");
            }
        });
    }

    /**
     * 检查多语言
     */
    function checkLan(obj) {
        if (me.Validate() == false) {
            return;
        }
        var isBldm = $("#bldmCk").is(':checked');
        var $obj = $(this);
        $obj.attr("disabled", "disabled");
        $.ajax({
            url: "@Url.Content("GetLangList")",
            data: "gitPath=" + txtGitPath + "&feature=" + txtGitFeature + "&isBldm="+isBldm,
            dataType:"json",
            success: function (re) {
                vueData.MeateList = re;
            },
            error: function (a, b, c) {
                alert(a.responseText);
            },
            complete:function() {
                $obj.removeAttr("disabled");
            }
        });
    }

    function Validate() {
        me.txtGitPath = $("#txtGitPath").val();
        me.txtGitFeature = $("#txtGitFeature").val();
        if (me.txtGitPath.trim() == "" || me.txtGitFeature.trim() == "") {
            alert("代码仓库地址、分支都不允许为空！");
            return false;
        }
        return true;
    }
</script>